<template>
  <view class="container">
    <view>
      <u--form labelPosition="left" :model="from" :rules="rules" ref="form1" labelWidth='100px'
               :labelStyle='labelStyle'>
        <view class="box">
          <u-form-item label="生产装置套数" prop="sczzts" borderBottom>
            <u--input v-model="from.sczzts" placeholder="填写生产装置套数" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="运行套数" prop="yxts" borderBottom>
            <u--input v-model="from.yxts" placeholder="填写运行套数" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="停车套数" prop="tcts" borderBottom>
            <u--input v-model="from.tcts" placeholder="填写停车套数" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="断路作业" prop="dlzy" borderBottom>
            <u--input v-model="from.dlzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="动土作业" prop="dtzy" borderBottom>
            <u--input v-model="from.dtzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="高处作业" prop="gczy" borderBottom>
            <u--input v-model="from.gczy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="临时用电作业" prop="lsydzy" borderBottom>
            <u--input v-model="from.lsydzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="吊装作业" prop="dzzy" borderBottom>
            <u--input v-model="from.dzzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="盲板作业" prop="mbzy" borderBottom>
            <u--input v-model="from.mbzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="二级动火作业" prop="ejdhzy" borderBottom>
            <u--input v-model="from.ejdhzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="一级动火作业" prop="yjdhzy" borderBottom>
            <u--input v-model="from.yjdhzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="受限空间作业" prop="sxkjzy" borderBottom>
            <u--input v-model="from.sxkjzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="检维修作业" prop="jwxzy" borderBottom>
            <u--input v-model="from.jwxzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="特殊动火作业" prop="tjdhzy" borderBottom>
            <u--input v-model="from.tjdhzy" placeholder="填写数量" border="none" disabled disabledColor="#ffffff"></u--input>
          </u-form-item>
          <u-form-item label="承包商作业" prop="sfycbszy" borderBottom >
            <u--input v-model="from.sfycbszy === 0? '否':'是'" disabled disabledColor="#ffffff" placeholder="是否承包商作业" border="none"></u--input>
          </u-form-item>
          <u-form-item label="试生产期" prop="sfcysscq" borderBottom>
            <u--input v-model="from.sfcysscq === 0? '否':'是'" disabled disabledColor="#ffffff" placeholder="是否处于试生产期" border="none"></u--input>
          </u-form-item>
          <u-form-item label="开停车状态" prop="sfcyktczt" borderBottom>
            <u--input v-model="from.sfcyktczt === 0? '否':'是'" disabled disabledColor="#ffffff" placeholder="是否处于开停车状态"
                      border="none"></u--input>
          </u-form-item>
          <u-form-item label="中（扩）试" prop="sfkzzks" borderBottom >
            <u--input v-model="from.sfkzzks === 0? '否':'是'" disabled disabledColor="#ffffff" placeholder="是否开展中(扩)试" border="none"></u--input>
          </u-form-item>
          <u-form-item label="重大隐患" prop="ywzdyh" borderBottom>
            <u--input v-model="from.ywzdyh === 0 ? '否':'是'" disabled disabledColor="#ffffff" placeholder="是否有重大隐患" border="none"></u--input>
          </u-form-item>
          <u-form-item label="风险级别" prop="fxjbs" borderBottom >
              <u--input  v-model="from.fxjbs" disabled disabledColor="#ffffff" placeholder="请选择风险级别" border="none"></u--input>
          </u-form-item>
          <u-form-item label="承诺日期" prop="cnrq" borderBottom>
            <u--input v-model="from.cnrq" disabled disabledColor="#ffffff" placeholder="请选择承诺日期" border="none"></u--input>
          </u-form-item>
          <u-form-item label="承诺人" prop="nickName" borderBottom >

            <u--input v-model="from.nickName" disabled disabledColor="#ffffff" placeholder="请输入承诺人" border="none"></u--input>
          </u-form-item>
          <u-form-item label="研判级别" prop="ypjb" borderBottom >
            <u--input v-model="from.ypjbs" disabled disabledColor="#ffffff" placeholder="请选择研判级别" border="none"></u--input>
          </u-form-item>
        </view>
      </u--form>
      <u-button type="primary" text="返回" @click="submit" class='but'></u-button>
    </view>
  </view>
</template>

<script>
import {judgmentRecordAPI,userInfoAPI} from '@/api/api.js'
export default {
  data() {
    return {
      labelStyle: {
        color: '#666'
      },
      option:{},
      from: {
        text: '',
        cnr:'',
        nickName: ''
      },
      show: false,
      rules: {
        // 'tjdhzy': {
        //   type: 'string',
        //   required: true,
        //   message: '请填写特殊动火作业',
        //   trigger: ['blur', 'change']
        // },
      },
    };
  },
  watch:{
    'from.fxjb'(val){
      switch (val){
        case "1":
          this.from.fxjbs = '高风险'
        case "2":
          this.from.fxjbs = '较大风险'
        case "3":
          this.from.fxjbs = '一般风险'
        case "4":
          this.from.fxjbs = '低风险'
      }
    },
    'from.ypjb'(val){
      switch (val){
        case "1":
          this.from.ypjbs = '公司'
        case "2":
          this.from.ypjbs = '车间'
        case "3":
          this.from.ypjbs = '班组'
      }
    }
  },
  onLoad(option){
  this.option = option
  },
  mounted(){
    judgmentRecordAPI({...this.option}).then((r)=>{
      userInfoAPI(r.data.cnr).then((res)=>{
        this.from  ={...r.data}
        this.from.nickName = res.data.nickName
      })
    })
  },
  methods: {
    submit() {
      uni.navigateBack({
      	delta: 1
      })
    }
  }
}
</script>

<style lang="scss">
.container {
  padding: 24rpx;
  background-color: #f6f6f6;

  .title {
    font-size: 28rpx;
    font-weight: 500;
    color: #999999;
    line-height: 44rpx;
    padding: 20rpx 48rpx;
  }

  .box {
    padding: 0rpx 48rpx;
    background-color: #fff;
    border-radius: 20rpx;
  }
}

.but {
  margin: 30rpx 0;
}
</style>
